package cn.itrip.search.controller;

import cn.itrip.beans.dto.Dto;
import cn.itrip.beans.vo.HotCityVo;
import cn.itrip.beans.vo.SearchQueryVo;
import cn.itrip.common.DtoUtils;
import cn.itrip.search.service.SearchService;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/hotellist")
public class SearchController {

    @Resource
    private SearchService searchService;

    /**
     * 搜索酒店
     * @param searchQueryVo
     * @return Dto
     */
    @RequestMapping(value="/searchItripHotelPage",method = RequestMethod.POST)
    public Dto searchItripHotelPage(@RequestBody SearchQueryVo searchQueryVo){
        try {
            return searchService.searchItripHotelPage(searchQueryVo);
        }catch (Exception e){
            return DtoUtils.getExcetpionDto(e,"");
        }
    }

    /**
     * 查询热点城市
     * @param hotCityVo
     * @return Dto
     */
    @RequestMapping(value="/searchItripHotelListByHotCity",method = RequestMethod.POST)
    public Dto searchItripHotelListByHotCity(@RequestBody HotCityVo hotCityVo){
        try {
            return searchService.searchItripHotelListByHotCity(hotCityVo);
        }catch (Exception e){
            return DtoUtils.getExcetpionDto(e,"");
        }
    }

}
